package com.itown.expo.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.web.servlet.ModelAndView;

import webframe.common.helper.ControllerHelper;

import com.itown.expo.controller.base.MyBaseCommandController;
import com.itown.expo.model.EntUserInfo;

public class EntUserSearchController extends MyBaseCommandController {

	@Override
	protected ModelAndView handleInner(HttpServletRequest request,
			HttpServletResponse response, Object command) {
		EntUserInfo cuser = (EntUserInfo) command;

		DetachedCriteria criteria = DetachedCriteria
				.forClass(EntUserInfo.class);
		ControllerHelper.addEqualRestrictions(criteria, "id", cuser.getId());
		ControllerHelper.addLikeRestrictions(criteria, "entCname", cuser
				.getEntCname());
		ControllerHelper.addLikeRestrictions(criteria, "declRegNo", cuser
				.getDeclRegNo());

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("page", ControllerHelper.queryPagination(request, criteria));

		map.put("cuser", cuser);
		return new ModelAndView("EntUserList.jsp", "map", map);
	}

}
